package com.centling;

import java.io.IOException;
import java.util.Map;
import java.util.Set;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ParameterServlet extends HttpServlet {

	@SuppressWarnings("unchecked")
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		System.out.println("doGet");
		
		Map<String,String[]> map =  req.getParameterMap();
		Set<String> set = map.keySet();
		for(String e : set){
			String[] value = map.get(e);
			System.out.println(e+"---"+value[0]);
		}
		
		
		resp.getWriter().write("doGet");
		
	}

	@SuppressWarnings("unchecked")
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		System.out.println("doPost");
		
		
		Map<String,String[]> map =  req.getParameterMap();
		Set<String> set = map.keySet();
		for(String e : set){
			String[] value = map.get(e);
			System.out.println(e+"---"+value[0]);
		}
		
		
		resp.setContentType("text/html");
		resp.getWriter().write("doPost");
	}

}
